import { LOADDATA } from './actionTypes'
import { fromJS, List } from 'immutable'

// list 是immutable，[]不是
// const defaultState = Map({
//   list: List([])
// })

const defaultState = fromJS({
  list: []
})

const reducer = (state = defaultState, action) => {
  switch (action.type) {
    case LOADDATA:
      return state.set('list', List(action.list))
      // return {
      //   list: action.list
      // }
    default:
      return state
  }
}

export default reducer